<template>
  <div>
    <h2>系统管理</h2>
    <h3>备份策略</h3>
    <el-form :model="form" label-width="120px">
      <el-form-item label="触发条件">
        <el-select v-model="backupCondition" placeholder="请选择">
          <el-option label="每日" value="daily"></el-option>
          <el-option label="每周" value="weekly"></el-option>
          <el-option label="每月" value="monthly"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="存储位置">
        <el-radio-group v-model="storageLocation">
          <el-radio :value="'本地缓存'">本地缓存</el-radio>
          <el-radio :value="'云端存储'">云端存储</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-button type="primary" @click="saveBackupSettings">保存设置</el-button>
    </el-form>

    <h3>审计日志</h3>
    <el-table :data="auditLogs">
      <el-table-column prop="user" label="用户"></el-table-column>
      <el-table-column prop="action" label="操作"></el-table-column>
      <el-table-column prop="timestamp" label="时间"></el-table-column>
    </el-table>
  </div>
</template>

<script>
import { ref } from 'vue';

export default {
  setup() {
    const backupCondition = ref('daily');
    const storageLocation = ref('本地缓存');
    const auditLogs = ref([
      { user: 'admin', action: '登录', timestamp: '2023-10-25 14:30' },
      { user: 'user1', action: '导出数据', timestamp: '2023-10-25 15:00' },
    ]);

    const saveBackupSettings = () => {
      // console.log('备份策略已保存:', backupCondition.value, storageLocation.value);
    };

    return {
      backupCondition,
      storageLocation,
      auditLogs,
      saveBackupSettings,
    };
  },
};
</script>